import { object_Inf } from "@/utils/typings/index.type";
import request from "@/utils/request";
import moldSpare_APi from "../moldSpare";
/*
 * @Descripttion:维修模具保养管理接口类
 * @LastEditors: xzh
 * @LastEditTime: 2023-11-01 19:36:18
 */
export default class moldUpkeep_APi extends moldSpare_APi {
  //#region 模具保养计划
  /**
   * @Author: xzh
   * @Descripttion:保存模具保养计划信息
   * @Param:
   * @param {object} data
   */
  static saveMoldUpkeepPlan = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenancePlan/SaveMouldMaintenancePlan",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除模具保养计划信息
   * @Param:
   * @param {Array} data
   */
  static deleteMoldUpkeepPlan = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenancePlan/DeleteMouldMaintenancePlan",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取模具保养计划信息
   * @Param:
   * @param {number} id 模具保养计划主键
   */
  static getMoldUpkeepPlanInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenancePlan/GetMouldMaintenancePlan",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取模具保养计划列表
   * @Param:
   */
  static getMoldUpkeepPlanList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenancePlan/GetMouldMaintenancePlanList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 模具保养记录
  /**
   * @Author: xzh
   * @Descripttion:保存模具保养记录信息
   * @Param:
   * @param {object} data
   */
  static saveMoldUpkeepRecord = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceRecord/SaveMouldMaintenanceRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除模具保养记录信息
   * @Param:
   * @param {Array} data
   */
  static deleteMoldUpkeepRecord = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceRecord/DeleteMouldMaintenanceRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取模具保养记录信息
   * @Param:
   * @param {number} id 模具保养记录主键
   */
  static getMoldUpkeepRecordInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceRecord/GetMouldMaintenanceRecord",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取模具保养记录列表
   * @Param:
   */
  static getMoldUpkeepRecordList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceRecord/GetMouldMaintenanceRecordList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  //#endregion

  //#region 模具保养项目
  /**
   * @Author: xzh
   * @Descripttion:保存模具保养项目信息
   * @Param:
   * @param {object} data
   */
  static saveMoldUpkeepItem = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceProject/SaveMouldMaintenanceProject",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除模具保养项目信息
   * @Param:
   * @param {Array} data
   */
  static deleteMoldUpkeepItem = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceProject/DeleteMouldMaintenanceProject",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改模具保养项目状态
   * @Param:
   * @param {Array} data
   */
  static updateMoldUpkeepItemStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceProject/UpdateMouldMaintenanceProjectStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取模具保养项目信息
   * @Param:
   * @param {number} id 模具保养项目主键
   */
  static getMoldUpkeepItemInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceProject/GetMouldMaintenanceProject",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取模具保养项目列表
   * @Param:
   */
  static getMoldUpkeepItemList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/MouldMaintenanceProject/GetMouldMaintenanceProjectList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 根据保养计划获取保养项目
   * @Param:
   * @param {number} planId 模具保养计划主键
   */
  static getMoldUpkeepItemByPlan = (
    planId: number
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/MouldMaintenanceProject/GetMaintenanceProjectListByPlanId",
      method: "get",
      params: { planId },
    });
  //#endregion
}
